CREATE PROCEDURE coreWFTaskingDeleteByProcessID
(
	@id	int
)
AS

	DECLARE @TaskingID int;
	
	DECLARE csr_Tasking CURSOR FOR 
		SELECT PK_ID FROM WFTasking WHERE FK_ProcessID=@id;
		
	OPEN csr_Tasking;
	FETCH NEXT FROM csr_Tasking INTO @TaskingID;
	
	WHILE @@FETCH_STATUS=0
	BEGIN
		EXEC coreWFTaskingDeleteByID @TaskingID;
		FETCH NEXT FROM csr_Tasking INTO @TaskingID;
	END
	
	CLOSE csr_Tasking;
	DEALLOCATE csr_Tasking;
	
	
